﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MyTest
{
    /// <summary>
    /// Action 的摘要说明
    /// </summary>
    public class Action : ICart
    {
        private ArrayList products = new ArrayList();
        public string Buy(Product p)
        {
            Add(p);
            return "购买" + p.Name;
        }
        
        public bool Add(Product p)
        {
            products.Add(p);
            return true;
        }

        public object Find()
        {
            throw new NotImplementedException();
        }

        public bool Remove()
        {
            throw new NotImplementedException();
        }

        public string Show()
        {
            string result = "";
            foreach (Product p in products)
            {
                
                if(p is Book2)
                {
                    result += ((Book2)p).Isbn;
                }
                result += p.Show() +"<br>";

                result += p.ShowDetail() + "<br>";
            }
            return result;
        }

        public bool Updata()
        {
            throw new NotImplementedException();
        }
    }
}
